package webrtcwrappers;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;

import org.webrtc.IceCandidate;

@JsonIgnoreProperties(ignoreUnknown = true)
public class IceCandidateInit {
    private String sdpMid;
    private int sdpMLineIndex;
    @JsonProperty("candidate")
    private String sdp;
    private String serverUrl;

    public IceCandidateInit(String sdpMid, int sdpMLineIndex, String sdp, String serverUrl) {
        this.sdpMid = sdpMid;
        this.sdpMLineIndex = sdpMLineIndex;
        this.sdp = sdp;
        this.serverUrl = serverUrl;
    }

    public IceCandidateInit() {

    }

    public String getSdpMid() {
        return sdpMid;
    }

    public int getSdpMLineIndex() {
        return sdpMLineIndex;
    }

    public String getSdp() {
        return sdp;
    }

    public String getServerUrl() {
        return serverUrl;
    }

    public static IceCandidate convertToIceCandidate(IceCandidateInit iceCandidateInit) {
        return new IceCandidate(iceCandidateInit.sdpMid, iceCandidateInit.sdpMLineIndex, iceCandidateInit.sdp);
    }
}
